package com.webbei.Backstage.action;

import java.io.IOException;

import org.apache.struts2.ServletActionContext;

import com.webbei.Backstage.service.BackstateSer;

public class checkLabelNameByLabelNameAction {
	private BackstateSer bao;
	private String labelName;
	public String execute(){
		System.out.println("check labelName :"+labelName);
		int i=bao.checkLabelName(labelName);
		if(i==1){
			System.out.println("the label name is exist");
			try {
				ServletActionContext.getResponse().getWriter().write("fail");
				ServletActionContext.getResponse().setContentType("text/html");
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}else{
			System.out.println("the label name not exist");
			try {
				ServletActionContext.getResponse().getWriter().write("success");
				ServletActionContext.getResponse().setContentType("text/html");
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		}
		return null;
	}
	public BackstateSer getBao() {
		return bao;
	}
	public void setBao(BackstateSer bao) {
		this.bao = bao;
	}
	public String getLabelName() {
		return labelName;
	}
	public void setLabelName(String labelName) {
		this.labelName = labelName;
	}
}
